/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.eps.modelo.javabeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author luis
 */
@Entity
@Table(name = "T_Zona")
@NamedQueries({
    @NamedQuery(name = "Zona.findAll", query = "SELECT z FROM Zona z"),
    @NamedQuery(name = "Zona.findByTZonaID", query = "SELECT z FROM Zona z WHERE z.tZonaID = :tZonaID"),
    @NamedQuery(name = "Zona.findByDescripcion", query = "SELECT z FROM Zona z WHERE z.descripcion = :descripcion")})
public class Zona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "T_Zona_ID")
    private Integer tZonaID;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tZonaID")
    private List<Localidad> localidadList;

    public Zona() {
    }

    public Zona(Integer tZonaID) {
        this.tZonaID = tZonaID;
    }

    public Zona(Integer tZonaID, String descripcion) {
        this.tZonaID = tZonaID;
        this.descripcion = descripcion;
    }

    public Integer getTZonaID() {
        return tZonaID;
    }

    public void setTZonaID(Integer tZonaID) {
        this.tZonaID = tZonaID;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<Localidad> getLocalidadList() {
        return localidadList;
    }

    public void setLocalidadList(List<Localidad> localidadList) {
        this.localidadList = localidadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tZonaID != null ? tZonaID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Zona)) {
            return false;
        }
        Zona other = (Zona) object;
        if ((this.tZonaID == null && other.tZonaID != null) || (this.tZonaID != null && !this.tZonaID.equals(other.tZonaID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "murguia.ejb30.entity.COMER.Zona[tZonaID=" + tZonaID + "]";
    }

}
